package page6;

import java.util.Scanner;

public class Ques1345 {
	
	public void go(){
		Scanner scan = new Scanner(System.in);
		int n;
		String str1,str2;
		int x,y;
		int a,b,c,d;
		while(scan.hasNext()){
			n = scan.nextInt();
			outter:while(n-- > 0){
				str1 = scan.next();
				str2 = scan.next();
				x = Math.abs(str1.charAt(0) - str2.charAt(0));
				y = Math.abs(str1.charAt(1) - str2.charAt(1));
				if(x == 0 && y == 0){
					System.out.println("0 "+"0 "+"0 "+"0");
					continue outter;
				}
				a = Math.min(x , y) + Math.abs(x - y);
				if(x == 0 || y == 0 || x == y){
					b = 1;
				}else{
					b = 2;
				}
				if(x == 0 || y == 0){
					c = 1;
				}else{
					c = 2;
				}
				if(x == y){
					System.out.println(a+" "+b+" "+c+" "+1);
				}else if(Math.abs(x - y) % 2 != 0){
					System.out.println(a+" "+b+" "+c+" "+"Inf");
				}else{
					System.out.println(a+" "+b+" "+c+" "+2);
				}
			}
		}
	}
	
	public static void main(String[] args) {
		new Ques1345().go();
	}
}
